import {setCookie, getCookie} from '@/util/user'

export function  savePositon(name,pos) {
  var position=JSON.parse(sessionStorage.getItem('position')) || []
  var obj={}
  obj[name] = pos
  position.push(obj)
  sessionStorage.setItem('position',JSON.stringify(position))
  setCookie(name, pos, 'd365')
}

export function getPosition(name) {
  var pos =0
  if(getCookie(name)){
    pos = getCookie(name)
  }else{
    pos =JSON.parse(sessionStorage.getItem('position'))[name]
  }
  return pos;

}

